package com.yklx.youke.repository;

import com.yklx.youke.entity.Teacher;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.UUID;

@Repository
public interface TeacherRepository extends JpaRepository<Teacher, UUID> {
    List<Teacher> findBySubjectsContaining(String subject);
    
    @Query("SELECT t FROM Teacher t WHERE :subject MEMBER OF t.subjects AND :gradeLevel MEMBER OF t.gradeLevels")
    List<Teacher> findBySubjectAndGradeLevels(@Param("subject") String subject, @Param("gradeLevel") String gradeLevel);
    
    List<Teacher> findByGradeLevelsContaining(String gradeLevel);
}